package com.gm.blog.service.impl;

import com.gm.blog.mapper.LinkMapper;
import com.gm.blog.pojo.Link;
import com.gm.blog.service.LinkService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 29944
 */
@Service
@Slf4j
public class LinkServiceImpl implements LinkService {
    @Autowired
    private LinkMapper linkMapper;

    /**
     * 插入友情链接实现
     * @param link
     */
    @Override
    public void save(Link link) {
        linkMapper.save(link);
    }

    /**
     * 更新分类
     * @param link
     */
    @Override
    public void update(Link link) {
        linkMapper.update(link);
    }

    /**
     * 更新分类信息
     * @param id
     * @return
     */
    @Override
    public Link getLinkById(Integer id) {
        return linkMapper.getLinkById(id);
    }

    /**
     * 获取全部分类
     * @return
     */
    @Override
    public List<Link> getLinkAll() {
        return linkMapper.getLinkAll();
    }

    /**
     * 更具ID来删除分类
     * @param id
     */
    @Override
    public void delete(Integer id) {
        linkMapper.delete(id);
    }
}
